package com.cdgeekcamp.redas.db.model;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import java.util.List;
import java.util.Optional;

public interface PositionRepository extends CrudRepository<Position, Integer> {
    Optional<Position> findBySrcNameAndSrcPosId(String srcName, String srcPosId);
    Page<Position> findAll(Pageable pageable);

    @Query(nativeQuery = true, value = "SELECT city FROM position GROUP BY city;")
    List<String> findGroupByCity();
}
